// 封装文章频道获取的逻辑
import {getArticleCategory} from '@/api/article'
import {useEffect, useState} from 'react'

const useChannel =  () => {
    const [channelList, setChannelList] = useState([])
    
    useEffect( () => {
        const getChannelList = async() => {
            const res = await getArticleCategory()
            // console.log(res.data.channels);
            setChannelList(res.data.channels)
        }
        getChannelList()
    }, [])
    // console.log(channelList);
    return channelList
  
}  
 export default useChannel